Skip to content

Instantly share code, notes, and snippets.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 13, 2024 08:40
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
// Gas efficient SQRT method, computes floor(sqrt(x)).
// Constant gas cost of 355
//
// For testing use this tool: https://www.evm.codes/playground?fork=cancun
// Author: Lohann Ferreira
PUSH0
CALLDATALOAD
PUSH1 1
DUP2
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active May 13, 2024 08:38
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@nimone
nimone / Carousel.jsx
Last active May 13, 2024 08:35
Build a carousel component like instagram purely in ReactJS and TailwindCSS

Linux 命令行编辑快捷键

初学者在Linux命令窗口(终端)敲命令时,肯定觉得通过输入一串一串的字符的方式来控制计算是效率很低。 但是Linux命令解释器(Shell)是有很多快捷键的,熟练掌握可以极大的提高操作效率。 下面列出最常用的快捷键,这还不是完全版。

  • 命令行快捷键:
    • 常用:
      • Ctrl L :清屏
  • Ctrl M :等效于回车
@zmts
zmts / tokens.md
Last active May 13, 2024 08:35
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@rpdelaney
rpdelaney / traceback_exc.py
Last active May 13, 2024 08:34
Serialize python exceptions into dictionaries
import traceback
from typing import Dict, Union, List
def traceback_exc(exc: Exception) -> Dict[str, Union[str, List[str]]]:
tb = traceback.TracebackException.from_exception(exc, capture_locals=True)
return {
"title": type(exc).__name__,
"message": str(exc),
"traceback": [
@sindresorhus
sindresorhus / esm-package.md
Last active May 13, 2024 08:32
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@dianjuar
dianjuar / i3-shortcuts-screenshot.md
Last active May 13, 2024 08:32
My i3 shortcuts to take screenshots

Requirements

  • maim
  • xclip

Set-up

Set this on your i3 config file ~/.i3/config

# Screenshots
#
# Reply to Weissman 2024
#
# Code to draw the spatial locations of market-linked infections and
# secondary++ infections, and estimate median distance to the market (origin)
#
# Initializations ####